<script>
  export default {
    onLaunch: function() {
      console.log('App Launch')
    },
    onShow: function() {
      console.log('App Show')
      // #ifdef APP
      setTimeout(() => {
        let args = plus.runtime.arguments;
        if (args) {
          let now = new Date().getTime()
          let storeParam = uni.getStorageSync('schemesParam')
          if (storeParam) { // 已存在
            let currentParam = args.split('=')[1]
            /* 并过期*/
            if (currentParam == storeParam.param && ((Number(now) - 10000) > Number(storeParam.expired_time))) {
              return
            }
          }

          // 处理args参数的逻辑代码，如直达到某新页面等
          let param = ''
          let path = ''
          if (args.includes('video_id=')) { // 分享到视频
            path = '/pages/video/video'
            param = args.split('video_id=')[1]
            uni.setStorageSync('share_video_id', param)
            
            uni.switchTab({
              url: '/pages/video/video'
            })

          } else if (args.includes('sharecode=')) { // 分享到注册
            path = '/pages/login/login_old?sharecode=' + param
            uni.navigateTo({
              url: path
            })
            param = args.split('sharecode=')[1]
          }
          let expired_time = new Date().getTime()
          uni.setStorageSync('schemesParam', {
            expired_time,
            param
          })

        }
      }, 500)
      // #endif
    },
    onHide: function() {
      console.log('App Hide')
    }
  }
</script>

<style lang="scss">
  /*每个页面公共css */
  @import "@/uni_modules/uview-ui/index.scss";
  @import '@/utils/custom.scss';

  .gradientCard {

    background: linear-gradient(267deg, rgba(0, 20, 255, 1) 0%, rgba(128, 31, 240, 1) 50%, rgba(255, 44, 223, 1) 100%);
    padding: 1px;
    border-radius: 8rpx;
    width: 100%;

    > :nth-child(1) {
      background-color: rgba(39, 44, 82, 1) !important;
      width: 100%;
      height: 100%;
      border-radius: 8rpx;
    }
  }


  .zIndex {
    z-index: 99;
  }

  view {
    box-sizing: border-box;
  }

  .lin {
    background-color: #272C52;
    border: 2rpx solid #707070;
    border-image: radial-gradient(#801FF0 50%, #FF2CDF 100%)14;
    border-radius: 18rpx
  }

  .page {
    width: 750rpx;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .pageWidth {
    width: 750rpx;
  }

  .w100 {
    width: 100%;
  }

  .h100 {
    height: 100%;
  }

  * {
    box-sizing: border-box;
  }

  .theme_color {
    color: #FBE23F;
  }

  .theme_bg {
    background-color: #FBE23F;
  }

  .card {
    width: 690rpx;
    border-radius: 20rpx;
    background-color: #fff;
  }

  .round {
    border-radius: 50%;
  }

  .ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
</style>